package com.xiaoshou.pojo;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "files", catalog = "market")
public class Files implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private String id;
	private User user;
	private String filename;
	private String filesize;
	private String md5;
	private String fileurl;
	private String uploadtime;
	private String lastupdatetime;
	private List<QuestionFilesRel> questionFilesRels = new ArrayList<QuestionFilesRel>();

	@Id
	@Column(name = "id", unique = true, nullable = false, length = 40)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userid", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "filename", length = 200)
	public String getFilename() {
		return this.filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	@Column(name = "filesize", length = 45)
	public String getFilesize() {
		return this.filesize;
	}

	public void setFilesize(String filesize) {
		this.filesize = filesize;
	}

	@Column(name = "md5", length = 45)
	public String getMd5() {
		return this.md5;
	}

	public void setMd5(String md5) {
		this.md5 = md5;
	}

	@Column(name = "fileurl", length = 200)
	public String getFileurl() {
		return this.fileurl;
	}

	public void setFileurl(String fileurl) {
		this.fileurl = fileurl;
	}

	@Column(name = "uploadtime", length = 45)
	public String getUploadtime() {
		return this.uploadtime;
	}

	public void setUploadtime(String uploadtime) {
		this.uploadtime = uploadtime;
	}

	@Column(name = "lastupdatetime", length = 45)
	public String getLastupdatetime() {
		return this.lastupdatetime;
	}

	public void setLastupdatetime(String lastupdatetime) {
		this.lastupdatetime = lastupdatetime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "files")
	public List<QuestionFilesRel> getQuestionFilesRels() {
		return questionFilesRels;
	}

	public void setQuestionFilesRels(List<QuestionFilesRel> questionFilesRels) {
		this.questionFilesRels = questionFilesRels;
	}

}